<?php
/**
 *
 * @Filename index.php $
 *
 * @Author nikm $
 *
 * @Date 2012-01-04 $
 */

//error_reporting(E_ERROR);
error_reporting(E_ALL|E_NOTICE);
ini_set('display_errors', 'on');

define('FROM_INDEX', true);
define('ROOT_PATH', dirname(__FILE__).'/');

require ROOT_PATH.'include/lib/load_setting.php';
load_setting('site_setting');
@header('Content-Type: text/html; charset='.CHARSET);

require ROOT_PATH.'include/function/global.func.php';

// Available modules
$mods = array('image'=>1, 'movie_titbit'=>1, 'movie_refer'=>1);

$mod = isset($_GET['m']) ? $_GET['m'] : (isset($_POST['m']) ? $_POST['m'] : '');
$act = isset($_GET['a']) ? $_GET['a'] : (isset($_POST['a']) ? $_POST['a'] : '');

if(!isset($mods[$mod]))
{
	$mod = 'index';
}

$mod_file = ROOT_PATH.'module/ajax/'.$mod.'.mod.php';

// Module does not exists
if(!file_exists($mod_file))
{
	include ROOT_PATH.'include/error_404.php';
	exit;
}

require $mod_file;

$request = array_merge($_GET, $_POST);
$request['mod'] = $mod;
$request['act'] = $act;

$module = new moduleObj($request);